import requests from '@/utlis/requests.js'

//加入购物车
export const addCart = ({ skuId, count }) =>
  requests.post('/member/cart', { skuId, count })

//获取购物车列表
export const getCartList = () => requests.get('/member/cart')

//删除购物车商品
export const removeCartItem = (ids) =>
  requests({
    url: '/member/cart',
    method: 'DELETE',
    data: {
      ids
    }
  })

//修改购物车商品的数量和状态
export const putCartItem = (id, { selected, count }) =>
  requests.put(`/member/cart/${id}`, { selected, count })

//购物车商品全选和取消全选
export const selAllItem = (selected, ids) =>
  requests.put('/member/cart/selected', { selected, ids })
